{% extends 'shippingcart/base_shopcart.html' %}
{% load static %}
{% block shopcart %}
	<!-- 顶部标题 -->
	<div class="bgf5 clearfix">
		<div class="top-user">
			<div class="inner">
				<a class="logo" href="{% url 'goods:index' %}" style="background-image: url({% static 'logo.jpg' %});border-radius: 50%;background-position: center;"></a>
				<div class="title">购物车</div>
			</div>
		</div>
	</div>
	<div class="content clearfix bgf5">
		<section class="user-center inner clearfix">
			<div class="user-content__box clearfix bgf">
				<div class="title">购物车-确认支付 </div>
				<div class="shop-title">收货地址</div>

				<form action="{% url 'order:create_order'%}" class="shopcart-form__box" method="post">
					{%csrf_token%}
					<div class="addr-radio">
						{% for foo in addr %}
						    <div class="radio-line radio-box active">
							<label class="radio-label ep" title={{ foo.address }} {{foo.people }} '收' {{ foo.phone }}>
								<input name="addr" checked="" value={{ foo.id }} autocomplete="off" type="radio"><i class="iconfont icon-radio"></i>
								{{ foo.province.area_name }} {{ foo.town.area_name }} {{ foo.district.area_name }}
								{{ foo.address }}
								（{{ foo.people }} 收） {{ foo.phone }}
							</label>
							<a href="javascript:;" class="default">默认地址</a>
							<a href="{% url 'user:udai_address' %}" class="edit">修改</a>
						</div>
						{% endfor %}



					</div>
					<div class="add_addr"><a href="{% url 'user:udai_address' %}">添加新地址</a></div>

					<div class="shop-order__detail">
						<table class="table">
							<thead>
								<tr>
									<th width="120"></th>
									<th width="300">商品信息</th>
									<th width="150">单价</th>
									<th width="200">数量</th>
									<th width="200">运费</th>
									<th width="80">总价</th>
								</tr>
							</thead>
							<tbody>

								{% for foo in data %}
								    <tr>
									<th scope="row"><a href="{% url 'goods:item_show' foo.goods.id %}"><div class="img"><img src={{ foo.goods.image  }} alt="" class="cover"></div></a></th>
									<td>
										<div class="name ep3">{{ foo.goods.name  }}</div>
										<div class="type c9">颜色分类：{{ foo.color }}  尺码：{{ foo.size }}</div>
									</td>
									<td>¥{{ foo.goods.price }}</td>
									<td>{{ foo.num }}
                                        <input type="hidden" name="sku" value={{ foo.goods.id }}>

                                    </td>
									<td>¥0.0</td>
									<td>¥{{ foo.price }}</td>


								</tr>
								{% endfor %}


							</tbody>
						</table>
                        <input type="hidden" name="time" value={{ time }}>
                        <input type="hidden" name="price" value={{ count_pice }}>


					</div>
					<div class="shop-cart__info clearfix">
						<div class="pull-left text-left">
							<div class="info-line text-nowrap">购买时间：<span class="c6">{{ time }}</span></div>
							<div class="info-line text-nowrap">交易类型：<span class="c6">担保交易</span></div>
							<div class="info-line text-nowrap">交易号：<span class="c6">{{ order_on }}</span></div>
						</div>
						<div class="pull-right text-right">
							<div class="form-group">
								<label for="coupon" class="control-label">优惠券使用：</label>
								<select id="coupon" >
									<option value="-1" selected>- 请选择可使用的优惠券 -</option>
									<option value="1">【满￥20.0元减￥2.0】</option>
									<option value="2">【满￥30.0元减￥2.0】</option>
									<option value="3">【满￥25.0元减￥1.0】</option>
									<option value="4">【满￥10.0元减￥1.5】</option>
									<option value="5">【满￥15.0元减￥1.5】</option>
									<option value="6">【满￥20.0元减￥1.0】</option>
								</select>
							</div>
							<script>
								$('#coupon').bind('change',function() {
									console.log($(this).val());
								})
							</script>
							<div class="info-line">优惠活动：<span class="c6">无</span></div>
							<div class="info-line">运费：<span class="c6">¥0.00</span></div>
							<div class="info-line"><span class="favour-value">已优惠 ¥2.0</span>合计：<b class="fz18 cr">¥{{ count_pice}}</b></div>
							<div class="info-line fz12 c9">（可获 <span class="c6">20</span> 积分）</div>
						</div>
					</div>


					<div class="user-form-group shopcart-submit">
						<button type="submit" class="btn">继续支付</button>
					</div>
					<script>
						$(document).ready(function(){
							$(this).on('change','input',function() {
								$(this).parents('.radio-box').addClass('active').siblings().removeClass('active');
							})
						});
					</script>
				</form>
			</div>
		</section>
	</div>
{% endblock %}